/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.producer.builder.major;

import java.util.Collection;
import java.util.Set;
import ru.jSkyRoom.interfaces.major.Armor;
import ru.jSkyRoom.interfaces.major.Enchantment;
import ru.jSkyRoom.interfaces.major.Keyword;
import ru.rakev.producer.CollectionProducer;
import ru.rakev.producer.DwindleProducer;
import ru.rakev.producer.Producer;
import ru.rakev.producer.builder.CollectionProducerBuilder;

/**
 *
 * @author Rakev
 */
public class ArmorProducerBuilder<F, C extends Armor> extends MajorProducerBuilder<F, C> {

    public static <T extends Armor> ArmorProducerBuilder<T, T> create(){
        return new ArmorProducerBuilder<>(new DwindleProducer<T>());
    }

    public ArmorProducerBuilder(Producer<F, C> producer) {
        super(producer);
    }

    
    public EnchantmentProducerBuilder<F, Enchantment> enchantment(){     
        Producer<C, Enchantment> enchntmentProducer = getProducerFactory().createEnchantmentProducer();
        Producer<F, Enchantment> creatingProducer = build(enchntmentProducer);
        return new EnchantmentProducerBuilder(creatingProducer);
    }

    
    public CollectionProducerBuilder<F, Set<Keyword>, Keyword> keywords(){     
        Producer<C, Set<Keyword>> keywordProducer = getProducerFactory().createKeywordsProducer();
        Producer<F, Set<Keyword>> creatingProducer = build(keywordProducer);
        return new CollectionProducerBuilder<>(creatingProducer);
    }

    
    public <T> Producer<F, Collection<T>> keywords(Producer<Keyword, T> elementProducer){     
        Producer<F, Set<Keyword>> keywordSetProducer = keywords().build();
        return new CollectionProducer(keywordSetProducer, elementProducer);
    }
    
}
